<template>
  <div>
    <div class="header border-bottom" v-for="item of list" :key="item.id">
      <span class="iconfont header-iconfont">&#xe6dd;</span>
      {{item.title}}
      <div v-if="item.children"><!-- 如果item里面有children属性,则调用自己-->
        <detail-list class="item-children" :list='item.children'></detail-list>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailList',
  props: {
    list: Array
  }
  // created() {
  //   console.log(this.list)
  // }
}
</script>

<style lang="stylus" scoped>
  .header
    position: relative
    left: .1rem
    top: .1rem
    line-height: .8rem
    font-size: .36rem
    .header-iconfont
      display: inline-block
      width: .36rem
      height: .36rem
      margin: 0 .2rem
      color: #00bcd4
    .item-children
      padding: 0 .2rem
</style>
